home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / obtainsemaphorelist.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  78 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: obtainsemaphorelist.c,v 1.4 1996/08/13 13:56:04 digulla Exp $
  4.     $Log: obtainsemaphorelist.c,v $
  5.     Revision 1.4  1996/08/13 13:56:04  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:14  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include "exec_intern.h"
  17. #include "semaphores.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <exec/semaphores.h>
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(void, ObtainSemaphoreList,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct List *, sigSem, A0),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 97, Exec)
  32.  
  33. /*  FUNCTION
  34.     This function obtains all semaphores in the list at once.
  35.     Note that this doesn't include arbitration for the list as
  36.     a whole - you will have to arbitrate for the whole list yourself.
  37.  
  38.     INPUTS
  39.     sigSem - pointer to list full of semaphores
  40.  
  41.     RESULT
  42.  
  43.     NOTES
  44.  
  45.     EXAMPLE
  46.  
  47.     BUGS
  48.  
  49.     SEE ALSO
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.  
  55. *****************************************************************************/
  56. {
  57.     __AROS_FUNC_INIT
  58.     struct Node *n;
  59.  
  60.     /*
  61.     There's no arbitration needed - the first semaphore in the list
  62.     list arbitrates for the full list.
  63.     Get first element in the list.
  64.     */
  65.     n=sigSem->lh_Head;
  66.  
  67.     /* And follow it. */
  68.     while(n->ln_Succ!=NULL)
  69.     {
  70.     /* Free the semaphore */
  71.     ReleaseSemaphore((struct SignalSemaphore *)n);
  72.  
  73.     /* Get next element */
  74.     n=n->ln_Succ;
  75.     }
  76.     __AROS_FUNC_EXIT
  77. } /* ReleaseSemaphoreList */
  78.